import SweepData from "../data/SweepData"
export class LegacySweepIdMap {
  sweepData: SweepData
  constructor(e) {
    this.sweepData = e
  }
  getIdForSweep(e) {
    return e.uuid
  }
  getSweepForId(e) {
    return this.sweepData.getSweepByUuid(e)
  }
  getIdFromCwfId(e) {
    const t = this.sweepData.getSweep(e)
    return this.getIdForSweep(t)
  }
}
export class SweepIdMap {
  sweepData: any
  constructor(e) {
    this.sweepData = e
  }
  getIdForSweep(e) {
    return e.id
  }
  getSweepForId(e) {
    return this.sweepData.getSweep(e)
  }
  getIdFromCwfId(e) {
    const t = this.sweepData.getSweep(e)
    return this.getIdForSweep(t)
  }
}
export class LegacyFloorIdMap {
  floorData: any
  constructor(e) {
    this.floorData = e
  }
  getIdForFloor(e) {
    return String(e.index)
  }
  getFloorForId(e) {
    return this.floorData.getFloorAtIndex(parseInt(e, 10))
  }
  getIdFromCwfId(e) {
    const t = this.floorData.getFloor(e)
    return this.getIdForFloor(t)
  }
}
export class FloorIdMap {
  floorData: any
  constructor(e) {
    this.floorData = e
  }
  getIdForFloor(e) {
    return e.id
  }
  getFloorForId(e) {
    return this.floorData.getFloor(e)
  }
  getIdFromCwfId(e) {
    const t = this.floorData.getFloor(e)
    return this.getIdForFloor(t)
  }
}
export class RoomValueMap {
  values: Map<any, any>
  constructor() {
    this.values = new Map()
  }
  get(e, t) {
    const o = RoomValueMap.keyFromGroupValues(e, t)
    return this.values.get(o)
  }
  set(e, t, o) {
    const n = RoomValueMap.keyFromGroupValues(e, t)
    this.values.set(n, o)
  }
  [Symbol.iterator]() {
    let e = 0
    const t = Array.from(this.values.entries())
    return {
      next() {
        if (e < t.length) {
          const o = t[e++],
            { meshGroup: n, meshSubgroup: r } = RoomValueMap.groupValuesFromKey(o[0])
          return { done: !1, value: { meshGroup: n, meshSubgroup: r, value: o[1] } }
        }
        return { done: !0, value: null }
      }
    }
  }
  static keyFromGroupValues(e, t) {
    return (e << 16) + t
  }
  static groupValuesFromKey(e) {
    return { meshGroup: e >> 16, meshSubgroup: 65535 & e }
  }
}
export class LegacyRoomIdMap {
  roomData: any
  constructor(e) {
    this.roomData = e
  }
  getIdForRoom(e) {
    return String(RoomValueMap.keyFromGroupValues(e.meshGroup, e.meshSubgroup))
  }
  getRoomForId(e) {
    const { meshGroup: t, meshSubgroup: o } = RoomValueMap.groupValuesFromKey(parseInt(e, 10))
    return this.roomData.getByMeshSubgroup(t, o)
  }
  getIdFromCwfId(e) {
    const t = this.roomData.get(e)
    return this.getIdForRoom(t)
  }
}
export class RoomIdMap {
  roomData: any
  constructor(e) {
    this.roomData = e
  }
  getIdForRoom(e) {
    return e.id
  }
  getRoomForId(e) {
    return this.roomData.get(e)
  }
  getIdFromCwfId(e) {
    const t = this.roomData.get(e)
    return this.getIdForRoom(t)
  }
}
